package com.exp.collection;

import java.util.ArrayList;
import java.util.Collections;


class Employe1 implements Comparable<Employe1> {
	int id;
	String Name;
	String Addr;
	String Gender;
	Double Sal;
	public Employe1(int a,String b,String c,Double d,String e) {
		this.id = a;
		this.Name = b;
		this.Addr =c;
		this.Sal = d;
		this.Gender = e;
	}
	
	public String toString() {
		return ( this.Gender);
		
	}
	public String getGender(){
		return this.Gender;
	}
	
	public void setGender(String s) {
		 this.Gender = s;
	}
	@Override
	public int compareTo(Employe1 o) {
		// TODO Auto-generated method stub
		
		return Gender.compareTo(o.getGender());
	}

}


public class SortCollByGender {

	public static void main(String[] args) {
		ArrayList<Employe1> emp = new ArrayList<Employe1>();
		emp.add(new Employe1(100,"Jaya","Blore",20000.40,"f"));
		emp.add(new Employe1(20,"maya","Mlore",25000.40,"f"));
		emp.add(new Employe1(3082,"liya","Hubli",200800.40,"m"));
		emp.add(new Employe1(150,"geeya","Bangalore",29000.40,"m"));
		emp.add(new Employe1(270,"Jaa","Blr",39000.40,"f"));
		System.out.println("Unsorted Gender");
		System.out.println(emp);
		Collections.sort(emp);
		System.out.println("After Sort by Gender" + emp);
	}
	

}
